from ogreEx.xml.CRElement import RElement



class RDocument(object):
    def __init__(self): 
        self.documentElement = None

    def appendChild(self, root): 
        self.documentElement = root

    def createElement(self, tag): 
        e = RElement(tag)
        e.document = self
        return e

    def toprettyxml(self):
        indent = 0
        lines = []
        self.documentElement.toprettyxml( lines, indent )
        return '\n'.join(lines)